home *** CD-ROM | disk | FTP | other *** search
/ TOS Silver 2000 / TOS Silver 2000.iso / programm / GNU_C++ / LIB / SRC / GEMLIB38.LZH / a_wind.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-07-10  |  6.1 KB  |  302 lines

  1. /*
  2.  * Aes window library interface
  3.  *
  4.  * ++jrb bammi@cadence.com
  5.  * modified: mj -- ntomczak@vm.ucs.ualberta.ca
  6.  * modified: cf -- felsch@tu-harburg.de
  7.  */
  8. #include "gem.h"
  9.  
  10.  
  11. int wind_calc(int Type, int Parts, int InX,  int InY, int InW, int InH, int *OutX, int *OutY, int *OutW, int *OutH)
  12. {
  13.     aes_intin[0] = Type;
  14.     aes_intin[1] = Parts;
  15.     aes_intin[2] = InX;
  16.     aes_intin[3] = InY;
  17.     aes_intin[4] = InW;
  18.     aes_intin[5] = InH;
  19.    aes_control[0] = 108;
  20.    aes_control[1] = 6;
  21.    aes_control[2] = 5;
  22.    aes_control[3] = 0;
  23.    aes_control[4] = 0;
  24.    aes(&aes_params);
  25.     *OutX = aes_intout[1];
  26.     *OutY = aes_intout[2];
  27.     *OutW = aes_intout[3];
  28.     *OutH = aes_intout[4];
  29.     return aes_intout[0];
  30. }
  31.  
  32.  
  33. int wind_close(int WindowHandle)
  34. {
  35.     aes_intin[0] = WindowHandle;
  36.    aes_control[0] = 102;
  37.    aes_control[1] = 1;
  38.    aes_control[2] = 1;
  39.    aes_control[3] = 0;
  40.    aes_control[4] = 0;
  41.    aes(&aes_params);
  42.     return aes_intout[0];
  43. }
  44.  
  45.  
  46. int wind_create(int Parts, int Wx, int Wy, int Ww, int Wh)
  47. {
  48.     aes_intin[0] = Parts;
  49.     aes_intin[1] = Wx;
  50.     aes_intin[2] = Wy;
  51.     aes_intin[3] = Ww;
  52.     aes_intin[4] = Wh;
  53.    aes_control[0] = 100;
  54.    aes_control[1] = 5;
  55.    aes_control[2] = 1;
  56.    aes_control[3] = 0;
  57.    aes_control[4] = 0;
  58.    aes(&aes_params);
  59.     return aes_intout[0];
  60. }
  61.  
  62.  
  63. int wind_delete(int WindowHandle)
  64. {
  65.     aes_intin[0] = WindowHandle;
  66.    aes_control[0] = 103;
  67.    aes_control[1] = 1;
  68.    aes_control[2] = 1;
  69.    aes_control[3] = 0;
  70.    aes_control[4] = 0;
  71.    aes(&aes_params);
  72.     return aes_intout[0];
  73. }
  74.  
  75.  
  76. int wind_find(int X, int Y)
  77. {
  78.     aes_intin[0] = X;
  79.     aes_intin[1] = Y;
  80.    aes_control[0] = 106;
  81.    aes_control[1] = 2;
  82.    aes_control[2] = 1;
  83.    aes_control[3] = 0;
  84.    aes_control[4] = 0;
  85.    aes(&aes_params);
  86.     return aes_intout[0];
  87. }
  88.  
  89.  
  90. int wind_get(int WindowHandle, int What, int *W1, int *W2, int *W3, int *W4)
  91. {
  92.     aes_intin[0] = WindowHandle;
  93.     aes_intin[1] = What;
  94.     if(What == WF_DCOLOR || What == WF_COLOR)
  95.         aes_intin[2] = *W1;
  96.    aes_control[0] = 104;
  97.    aes_control[1] = 2;
  98.    aes_control[2] = 5;
  99.    aes_control[3] = 0;
  100.    aes_control[4] = 0;
  101.    aes(&aes_params);
  102.     *W1 = aes_intout[1];
  103.     *W2 = aes_intout[2];
  104.     *W3 = aes_intout[3];
  105.     *W4 = aes_intout[4];
  106.     return aes_intout[0];
  107. }
  108.  
  109.  
  110. void wind_new(void)
  111. {
  112.    aes_control[0] = 109;
  113.    aes_control[1] = 0;
  114.    aes_control[2] = 0;
  115.    aes_control[3] = 0;
  116.    aes_control[4] = 0;
  117.    aes(&aes_params);
  118. }    
  119.  
  120.  
  121. int wind_open(int WindowHandle, int Wx, int Wy, int Ww, int Wh)
  122. {
  123.     aes_intin[0] = WindowHandle;
  124.     aes_intin[1] = Wx;
  125.     aes_intin[2] = Wy;
  126.     aes_intin[3] = Ww;
  127.     aes_intin[4] = Wh;
  128.    aes_control[0] = 101;
  129.    aes_control[1] = 5;
  130.    aes_control[2] = 1;
  131.    aes_control[3] = 0;
  132.    aes_control[4] = 0;
  133.    aes(&aes_params);
  134.     return aes_intout[0];
  135. }
  136.  
  137.  
  138. int wind_set(int WindowHandle, int What, int W1, int W2, int W3, int W4)
  139. {
  140.     aes_intin[0] = WindowHandle;
  141.     aes_intin[1] = What;
  142.  
  143. #ifdef __MSHORT__
  144.     aes_intin[2] = W1;
  145.     aes_intin[3] = W2;
  146.     aes_intin[4] = W3;
  147.     aes_intin[5] = W4;
  148. #else
  149.     /* for 32 bit ints stuff the address into aes_intin[2] and [3] */
  150.     switch(What)
  151.     {
  152.         case WF_NAME: 
  153.         case WF_INFO: 
  154.         case WF_NEWDESK:
  155.             { 
  156.                 unsigned short *s = (unsigned short *)&W1;
  157.                 aes_intin[2] = s[0];
  158.                 aes_intin[3] = s[1];
  159.                 if(What == WF_NEWDESK)
  160.                     aes_intin[4] = W2;
  161.             }
  162.             break;
  163.         default:
  164.             aes_intin[2] = W1;
  165.             aes_intin[3] = W2;
  166.             aes_intin[4] = W3;
  167.             aes_intin[5] = W4;
  168.     }
  169. #endif
  170.  
  171.    aes_control[0] = 105;
  172.    aes_control[1] = 6;
  173.    aes_control[2] = 1;
  174.    aes_control[3] = 0;
  175.    aes_control[4] = 0;
  176.    aes(&aes_params);
  177.     return aes_intout[0];
  178. }
  179.  
  180.  
  181. int wind_update(int Code)
  182. {
  183.     aes_intin[0] = Code;
  184.    aes_control[0] = 107;
  185.    aes_control[1] = 1;
  186.    aes_control[2] = 1;
  187.    aes_control[3] = 0;
  188.    aes_control[4] = 0;
  189.    aes(&aes_params);
  190.     return aes_intout[0];
  191. }
  192.  
  193.  
  194. /*
  195.  * Some usefull extensions.
  196. */
  197. int wind_calc_grect(int Type, int Parts, GRECT *In, GRECT *Out)
  198. {
  199.     aes_intin[0] = Type;
  200.     aes_intin[1] = Parts;
  201.     aes_intin[2] = In->g_x;
  202.     aes_intin[3] = In->g_y;
  203.     aes_intin[4] = In->g_w;
  204.     aes_intin[5] = In->g_h;
  205.    aes_control[0] = 108;
  206.    aes_control[1] = 6;
  207.    aes_control[2] = 5;
  208.    aes_control[3] = 0;
  209.    aes_control[4] = 0;
  210.    aes(&aes_params);
  211.     Out->g_x = aes_intout[1];
  212.     Out->g_y = aes_intout[2];
  213.     Out->g_w = aes_intout[3];
  214.     Out->g_h = aes_intout[4];
  215.     return aes_intout[0];
  216. }
  217.  
  218.  
  219. int wind_create_grect(int Parts, GRECT *r)
  220. {
  221.     aes_intin[0] = Parts;
  222.     aes_intin[1] = r->g_x;
  223.     aes_intin[2] = r->g_y;
  224.     aes_intin[3] = r->g_w;
  225.     aes_intin[4] = r->g_h;
  226.    aes_control[0] = 100;
  227.    aes_control[1] = 5;
  228.    aes_control[2] = 1;
  229.    aes_control[3] = 0;
  230.    aes_control[4] = 0;
  231.    aes(&aes_params);
  232.     return aes_intout[0];
  233. }
  234.  
  235.  
  236. void wind_get_grect(int WindowHandle, int What, GRECT *r)
  237. {
  238.     aes_intin[0] = WindowHandle;
  239.     aes_intin[1] = What;
  240.    aes_control[0] = 104;
  241.    aes_control[1] = 2;
  242.    aes_control[2] = 5;
  243.    aes_control[3] = 0;
  244.    aes_control[4] = 0;
  245.    aes(&aes_params);
  246.     r->g_x = aes_intout[1];
  247.     r->g_y = aes_intout[2];
  248.     r->g_w = aes_intout[3];
  249.     r->g_h = aes_intout[4];
  250. }
  251.  
  252.  
  253. int wind_open_grect(int WindowHandle, GRECT *r)
  254. {
  255.     aes_intin[0] = WindowHandle;
  256.     aes_intin[1] = r->g_x;
  257.     aes_intin[2] = r->g_y;
  258.     aes_intin[3] = r->g_w;
  259.     aes_intin[4] = r->g_h;
  260.    aes_control[0] = 101;
  261.    aes_control[1] = 5;
  262.    aes_control[2] = 1;
  263.    aes_control[3] = 0;
  264.    aes_control[4] = 0;
  265.    aes(&aes_params);
  266.     return aes_intout[0];
  267. }
  268.  
  269.  
  270. void wind_set_grect(int WindowHandle, int What, GRECT *r)
  271. {
  272.     aes_intin[0] = WindowHandle;
  273.     aes_intin[1] = What;
  274.     aes_intin[2] = r->g_x;
  275.     aes_intin[3] = r->g_y;
  276.     aes_intin[4] = r->g_w;
  277.     aes_intin[5] = r->g_h;
  278.    aes_control[0] = 105;
  279.    aes_control[1] = 6;
  280.    aes_control[2] = 1;
  281.    aes_control[3] = 0;
  282.    aes_control[4] = 0;
  283.    aes(&aes_params);
  284. }
  285.  
  286.  
  287. void wind_set_str(int WindowHandle, int What, char *str)
  288. {
  289.     unsigned short *s = (unsigned short *)&str;
  290.  
  291.     aes_intin[0] = WindowHandle;
  292.     aes_intin[1] = What;
  293.     aes_intin[2] = s[0];
  294.     aes_intin[3] = s[1];
  295.    aes_control[0] = 105;
  296.    aes_control[1] = 6;
  297.    aes_control[2] = 1;
  298.    aes_control[3] = 0;
  299.    aes_control[4] = 0;
  300.    aes(&aes_params);
  301. }
  302.